/**
 * @constructor
 * 
 * @param{Canvas} canvas The JQuery canvas object
 * @param{float} updateTimeMs The update time interval 
 */

function Sprite(canvas, updateTimeMs, debugConsole) {
	
	this.canvas = canvas;
	this.updateTimeMs = updateTimeMs;
	this.debugConsole = debugConsole;
	
	this.xLeft = 0;
	this.yTop = 0;
	this.width = 10;
	this.height = 10;
	this.x = 5;
	this.y = 5;
	
	/**
	 * @public
	 * 
	 * @param{int} x The new x location of the Sprite's center
	 * @param{int} y the new y location of the Sprite's center
	 */
	this.moveCenterAt = function(x,y) {
		this.x = x; 
		this.y = y;
		this.xLeft = this.x - this.width/2;
		this.yTop = this.y - this.height/2;
	};
	
	/**
	 * @public
	 * 
	 * @param{int} dx The amount to move the Sprite by on the x axis
	 * @param{int} dy The amount to move the Sprite by on the y axis
	 */
	this.moveBy = function(dx, dy) {
		this.moveCenterAt(this.x+dx, this.y+dy);
	};
	
	
	/**
	 * @public
	 * 
	 * @param{int} deg The degrees by which the sprite is to be rotated
	 * @param{boolean} cw If "true" rotate clock-wise, if "false" rotate counter-clock-wise
	 * 
	 */
	this.rotateBy = function(deg, cw) {
		//TODO
	};
	
	/**
	 * @public
	 * 
	 * @param x{int}
	 * @param y{int}
	 * 
	 * @returns{boolean} "true" if the coords are within this sprite, "false" otherwise
	 */
	
	this.contains = function(x, y) {
		doesContain =  (x >= this.xLeft &&
						x < this.xLeft + this.width &&
						y >= this.yTop && 
						y < this.yTop + this.height);
		
		mouseX = x;
		mouseY = y;
		
		return doesContain;
						
						
	};
	
	/**
	 * @public
	 * 
	 * @param x
	 * @param y
	 */
	this.onMouseMove = function(x,y,mouseDown) {
		
	};
	
	/**
	 * @public
	 * 
	 * @param x
	 * @param y
	 */
	this.onMouseOver = function(x,y,mouseDown) {
		
	};
	
	/**
	 * @public
	 * 
	 * @param x
	 * @param y
	 */
	this.onMouseOut = function(x,y,mouseDown) {
		
	};
	
	/**
	 * @public
	 * 
	 * @param x
	 * @param y
	 */
	this.onMouseDown = function(x,y) {
		
	};
	
	/**
	 * @private
	 */
	this.update = function() {
		this.canvas.drawRect({
			  strokeStyle: "#000",
			  strokeWidth: 1,
			  x: this.x, y: this.y,
			  width: this.width,
			  height: this.height,
			  fromCenter:true
			});
		
	};
	
}